home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / OOFILE headers / oofctrex.inl < prev    next >
Encoding:
Text File  |  1995-09-27  |  3.9 KB  |  178 lines  |  [TEXT/CWIE]

  1. // COPYRIGHT 1994 A.D. Software, All rights reserved
  2.  
  3. // OOFILE c-tree Plus backend implementation
  4.  
  5. // IMPLEMENTATION inline definitions
  6.  
  7.  
  8. // -------------------------------------------------------
  9. //    O O F _ t a b l e B a c k e n d _ c t r e e
  10. // -------------------------------------------------------
  11. inline void OOF_tableBackend_ctree::ResetCtreeFileNoForStartOfConnection(COUNT nextFileNo)
  12. {
  13.     OOF_tableBackend_ctree::sNextFileNo = nextFileNo;
  14. }
  15.  
  16.  
  17. inline void OOF_tableBackend_ctree::EnsureOurContextMatchesISAM()
  18. // this routine is necessary as we may have a clone of this selection
  19. // that's changed the current ISAM record
  20. // it's also not a bad sanity check on ourself if we've moved records
  21. // NOT YET IMPLEMENTED an optimisation that might be applied would
  22. // be to only perform this test if this backend has been cloned
  23. {
  24.     if (mCurrLoadedRecOffset != CurrentFileOffset(mISAMdatno))
  25.         SetISAMtoContext(this);
  26. }
  27.  
  28.  
  29.  
  30. // -------------------------------------------------------
  31. //            O O F _ C o n t e x t _ c t r e e
  32. // -------------------------------------------------------
  33. inline void OOF_Context_ctree::SetOffset(LONG off)
  34. {
  35.     mCurrLoadedRecOffset = off;
  36. }
  37.  
  38.  
  39. inline VRLEN OOF_tableBackend_ctree::BlobLenFromBuffer(const dbField* fld, const char* theirBuffer) const
  40. {
  41.         return BlobLenFromBuffer(fld->fieldNumber(), theirBuffer);  
  42. }
  43.  
  44.  
  45. inline LONG OOF_tableBackend_ctree::BlobPosFromBuffer(const dbField* fld, const char* theirBuffer) const
  46. {
  47.         return BlobPosFromBuffer(fld->fieldNumber(), theirBuffer);  
  48. }
  49.  
  50.  
  51.  
  52. // -------------------------------------------------------
  53. //         O O F _ c t r e e S e l e c t i o n R e p
  54. // -------------------------------------------------------
  55.  
  56. inline unsigned long* OOF_ctreeSelectionRep::ExposeArray() 
  57.     return mBits; 
  58.  
  59.  
  60. inline void OOF_ctreeSelectionRep::MarkAsUsed(unsigned long numUsedAtFront)
  61.     mNextFreeEntry = numUsedAtFront; 
  62.  
  63.  
  64. // -------------------------------------------------------
  65. //               O O F _ c t r e e S e l e c t i o n
  66. // -------------------------------------------------------
  67.  
  68. inline unsigned long OOF_ctreeSelection::count() const
  69. {
  70.     if (!mRep)
  71.         return 0;
  72.     return mRep->count();
  73. }
  74.  
  75.  
  76. inline void OOF_ctreeSelection::start() 
  77. {
  78.     mInternalIter = 0;
  79. }
  80.  
  81.  
  82. inline bool OOF_ctreeSelection::more() const
  83. {
  84.     return mInternalIter < count();
  85. }
  86.  
  87.  
  88. inline void OOF_ctreeSelection::next() 
  89. {
  90.     mInternalIter++;
  91. }
  92.  
  93.  
  94. inline OOF_ctreeSelection::selectionState OOF_ctreeSelection::state() const
  95. {
  96.     return mState;
  97. }
  98.  
  99.  
  100. inline bool OOF_ctreeSelection::isEmpty() const
  101. {
  102.     return mState==empty;
  103. }
  104.  
  105.  
  106. inline LONG OOF_ctreeSelection::oneRecOffset() const
  107. {
  108.     return mCurrSingleRecOffset;
  109. }
  110.  
  111.  
  112. inline unsigned long& OOF_ctreeSelection::operator()() // current value
  113.     assert(mRep);
  114.     return mRep->operator[](mInternalIter);
  115. }
  116.  
  117.  
  118. inline unsigned long& OOF_ctreeSelection::currentItem() 
  119.     assert(mRep);
  120.     return mRep->operator[](mInternalIter);
  121. }
  122.  
  123.  
  124. inline unsigned long& OOF_ctreeSelection::operator[](long index)
  125. {
  126.     assert(index>=0);
  127.     assert(mRep);
  128.     return mRep->operator[] ((unsigned int) index);
  129. }
  130.  
  131.  
  132. inline unsigned long& OOF_ctreeSelection::operator[](unsigned long index)
  133. {
  134.     assert(mRep);
  135.     return mRep->operator[](index);
  136. }
  137.  
  138.  
  139. inline unsigned long OOF_ctreeSelection::value(unsigned long index) const
  140. {
  141.     assert(mRep);
  142.     return mRep->value(index);
  143. }
  144.  
  145.  
  146. // -------------------------------------------------------
  147. //    O O F _ c t r e e I n d e x D e s c r i p t i o n
  148. // -------------------------------------------------------
  149. inline fieldNumT OOF_ctreeIndexSegList::fieldNo(unsigned short segmentNo) const
  150. {
  151.     assert(segmentNo<sizeof(mSegmentFieldNos)/sizeof(unsigned short));
  152.     return mSegmentFieldNos[segmentNo];
  153. }
  154.  
  155.  
  156. inline COUNT OOF_ctreeIndexSegList::indexFileNo() const
  157. {
  158.     return mIndexFileNo;
  159. }
  160.  
  161.  
  162. inline const dbCompoundField* OOF_ctreeIndexSegList::indexField() const
  163. {
  164.     return mIndexField;
  165. }
  166.  
  167.  
  168. inline bool OOF_ctreeIndexSegList::startsWith(unsigned short fieldNo) const
  169. {
  170.     return (mSegmentFieldNos[0]==fieldNo);
  171. }
  172.